<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</h:head>
<h:body>
	<h:form id="form">  
  
    <p:panel id="panel" header="Departamento">  
        <h:panelGrid columns="2">  
        	        
            <h:outputLabel for="descricao" value="Nome do Departamento: *" />  
            <p:inputText id="descricao" value="#{departamentoBean.departamento.descricao}" required="true">  
                <f:validateLength minimum="2" /> 
            </p:inputText>             
            
            <h:outputLabel for="sigla" value="Sigla: *" />  
            <p:inputText id="sigla" value="#{departamentoBean.departamento.sigla}" required="true" >  
                <f:validateLength minimum="2" />  
                        
            </p:inputText>
            
            <h:outputLabel for="gestor" value="Gestor: *" />  
            <p:selectOneMenu value="#{departamentoBean.idGestorSelecionado}">
            	<f:selectItem noSelectionOption="true" itemLabel=""></f:selectItem>
            	<f:selectItems itemLabel="#{gestor.nome}" var="gestor" itemValue="#{gestor.codigo}" value="#{departamentoBean.listarGestor}"></f:selectItems>
            </p:selectOneMenu>
            
            
            <h:outputLabel for="departamentoSuperior" value="Departamento Superior: *" />  
             <p:selectOneMenu value="#{departamentoBean.idDepartamentoSuperiorSelecionado}">
              <f:selectItem noSelectionOption="true" itemLabel=""></f:selectItem>
                <f:selectItems itemLabel="#{deptSup.descricao}" var="deptSup" itemValue="#{deptSup.codigo}" value="#{departamentoBean.listarTodosDepartamentos}"></f:selectItems>
            </p:selectOneMenu>
         
			<h:outputLabel for="situacao" value="Situacao: *" />  
            <p:selectOneMenu value="#{departamentoBean.departamento.situacao}">
                   	<f:selectItems itemLabel="#{deptSitu}" var="deptSitu" itemValue="#{deptSitu}" value="#{departamentoBean.situacao}"></f:selectItems>
            </p:selectOneMenu>
              	<h:inputHidden value="#{departamentoBean.departamento.codigo}"></h:inputHidden>
        </h:panelGrid >  
  
 	 <f:facet name="footer">
        <p:commandButton id="btn" value="Salvar" update="panel" action="#{departamentoBean.inserirDepartamento}"/>  
        <p:commandButton action="menu-principal.xhtml?faces-redirect=true" immediate="true" ajax="false" value="Home"/>
     </f:facet>   
        <h:messages></h:messages>
    	</p:panel>  
   
</h:form>   
</h:body>
</html>